package pnu.ssm.area;

public class HeronFormula {
	public static double heron(Point p1, Point p2, Point p3){
		double a = p1.getDistanceWith(p2);
		double b = p2.getDistanceWith(p3);
		double c = p3.getDistanceWith(p1);
		double s = (a+b+c) / 2;
		double area = Math.sqrt(s*(s-a)*(s-b)*(s-c));
		return area;
	}
	
	public static void main(String[] args) {
		double area = heron(new Point(0,0), new Point(0,6), new Point(3,3));
		System.out.println(area);
	}
	
}

class Point{
	public int x;
	public int y;
	public Point(int x, int y) {
		this.x = x;
		this.y = y;
	}
	public double getDistanceWith(Point other){
		double distance = Math.sqrt((other.x - x) * (other.x - x) + (other.y - y) * (other.y - y));
		return distance;
	}
}

